/**
 * 导入改写districExplorer的函数，添加不同功能
 */
// ------------ 绘制函数 ------------------
import addTipmark from "./function/tipMark"

import {
    renderAreaNode
} from "./function/renderAreaNode"
import {addGoInside} from "./function/goInside";

// -------- 添加DE模块 -----------
export function addDEForHeat(adcode, map, that,big_zoom) {
    AMapUI.loadUI(['geo/DistrictExplorer'], function (DistrictExplorer) {
        initPage(DistrictExplorer, adcode, map, that,big_zoom);
    });
}

// ----------- 启动页面 -------------
// areaNode对象由de的loadAreaNode方法的回调函数获得，获得adcode所指areaNode

function initPage(DistrictExplorer, adcode, map,big_zoom) {
    // de对象
    let districtExplorer = new DistrictExplorer({
        eventSupport: true, //打开事件支持
        map,
        zIndex: 8
    });
    // -------- 绘制节点 --------------
    districtExplorer.loadAreaNode(adcode, function (error, areaNode) {
        if (error) {
            console.error(error);
            return;
        }
        renderAreaNode(districtExplorer, areaNode, map);
    });
    // -------- 增加功能 --------------`
    // 增加鼠标提示
    addTipmark(districtExplorer, map);
    addGoInside(districtExplorer, map,adcode,big_zoom);
}